// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'

var app = angular.module('weather', ['ionic']);
console.log(localStorage.first);
//ionic包含uiRouter
app.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
    if(!localStorage.first)
    {
        $urlRouterProvider.otherwise('/slide')//找不到地址的时候会跳这个地址
        localStorage.first=1;

    }
    else
    {
        $urlRouterProvider.otherwise('/home')
    }

    $stateProvider.state('slider', {
        //引导图
        url: '/slide',
        templateUrl: 'views/slide.html'
    })

        .state('home',{
            url:'/home',
            templateUrl:'views/home.html',
            controller:'HomeController'
        })
        .state('weather',{
            url:'/weather',
            templateUrl:'views/weather.html',
            controller:'WeatherController'

        })
        .state('nearby',{
            url:'/nearby',
            templateUrl:'views/nearby.html',
            controller:'NearbyController'
        })
        .state('check',{
        url:'/check',
        templateUrl:'views/check.html',
        controller:'CheckController'
    })

}])

//app.config(function($ionicPlatform){
//
//})

app.run(function ($ionicPlatform) {
    $ionicPlatform.ready(function () {
        if (window.cordova && window.cordova.plugins.Keyboard) {
            // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
            // for form inputs)
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

            // Don't remove this line unless you know what you are doing. It stops the viewport
            // from snapping when text inputs are focused. Ionic handles this internally for
            // a much nicer keyboard experience.
            cordova.plugins.Keyboard.disableScroll(true);
        }
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }
    });
})
